package com.jy.wms.common.quartz;

import com.jy.wms.service.WmsStoreHouseService;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.SimpleDateFormat;
import java.util.Date;

public class WmsStoreHouseScheduledJob implements Job {
//
    private WmsStoreHouseService wmsstorehouseservice;
    private static Logger log = LoggerFactory.getLogger(WmsProvinceAlarmScheduledJob.class);
    private SimpleDateFormat dateFormat() {
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    }

    @Override
    public void execute(JobExecutionContext Context) throws JobExecutionException {

        try {
            log.info("期初库存查询启动时间：" + dateFormat().format(new Date()));
            JobDataMap dataMap = Context.getJobDetail().getJobDataMap();
            wmsstorehouseservice = (WmsStoreHouseService)dataMap.get("WmsStoreHouseService");
            log.info("期初库存查询启动时间：" + dateFormat().format(new Date()));
            wmsstorehouseservice.baseSelectByPrimaryKey();
        }catch (Exception e){
            e.printStackTrace();
            log.error("期初库存查询数据异常");
            log.error(e.getMessage());
        }
    }
}
